/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.util.HashMap;
import java.util.Map;
import libCore.Util;
import share.ShareMacros;

/**
 *
 * @author LinhTA
 */
public class Penguin implements EntityBase{
    
    public String kind;
    public int level;
    public int exp;
    public int food;
    public long timeEat;
    public long timeSpawn;

    
    @Override 
    public Map<String,Object> toAMF()
    {
        Map<String,Object> data = new HashMap<String, Object>();
        
        data.put(ShareMacros.KIND, kind);
        data.put(ShareMacros.LEVEL, level);
        data.put(ShareMacros.EXP, exp);
        data.put(ShareMacros.FOOD, food);
        data.put(ShareMacros.PEGS_TIMEEAT, timeEat);
        data.put(ShareMacros.PEGS_TIMESPAWN, timeSpawn);
        
        return data;
    }
    
    @Override 
    public void setData(Map<String, Object> obj)
        {
            Map<String,Object> data = Util.obj2Map(obj);
            
            level = Integer.parseInt(data.get(ShareMacros.LEVEL).toString());
            kind = data.get(ShareMacros.KIND).toString();   
            exp  = Integer.parseInt(data.get(ShareMacros.EXP).toString());
            food = Integer.parseInt(data.get(ShareMacros.FOOD).toString());
            timeEat = Long.parseLong(data.get(ShareMacros.PEGS_TIMEEAT).toString());
            timeSpawn = Long.parseLong(data.get(ShareMacros.PEGS_TIMESPAWN).toString());
        }
    
    
    
//    public static  class PengData{
//    public int type;
//    public long exp;
//    public long time_eat;
//    public String id;
//    
//    public Map<String, Object> toObj()
//    {
//        Map<String, Object> data = new HashMap<String, Object>();
//        data.put("type", type);
//        data.put("exp", exp);
//        data.put("time_eat", time_eat);
//        data.put("id", id);
//        
//        return data;
//    }
//    
//
//}
//    
//   
    
}
